﻿<%@ Page Language="C#" MasterPageFile="~/Theme/Stander/Stander.master" AutoEventWireup="true" CodeFile="Agent.aspx.cs" Inherits="Customer_Agent" %>
<%@ Register Src="../User Controls/ContactListControl.ascx" TagName="ContactListControl"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h2>代理信息</h2>
<asp:DetailsView ID="AgentDetailsView" runat="server"
    AutoGenerateRows="False" DataKeyNames="Id" DataSourceID="AgentDataSource"
    OnItemInserted="AgentDetailsView_ItemInserted" OnItemInserting="AgentDetailsView_ItemInserting" OnItemUpdating="AgentDetailsView_ItemUpdating">
    <Fields>
        <asp:TemplateField HeaderText="名称：">
            <InsertItemTemplate>
                <asp:TextBox id="txtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                <asp:Label ID="lblNameError" runat="server" Text="" CssClass="error"></asp:Label>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" SetFocusOnError="true" 
                    runat="server" ErrorMessage="*" ControlToValidate="txtName">
                </asp:RequiredFieldValidator>
            </InsertItemTemplate>
            <EditItemTemplate>
                <asp:TextBox id="txtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                <asp:Label ID="lblNameError" runat="server" Text="" CssClass="error"></asp:Label>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" SetFocusOnError="true" 
                    runat="server" ErrorMessage="*" ControlToValidate="txtName">
                </asp:RequiredFieldValidator>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:TextBox id="txtName" runat="server" Text='<%# Bind("Name") %>' ReadOnly="true"></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="Tel" HeaderText="电话：" SortExpression="Tel" />
        <asp:BoundField DataField="Fax" HeaderText="传真：" SortExpression="Fax" />
        <asp:BoundField DataField="Mobile" HeaderText="手机：" SortExpression="Mobile" />
        <asp:BoundField DataField="Email" HeaderText="Email：" SortExpression="Email" />
        <asp:BoundField DataField="MSN" HeaderText="MSN：" SortExpression="MSN" />
        <asp:TemplateField HeaderText="地址：">
            <InsertItemTemplate>
                <asp:TextBox id="txtAdress" runat="server" CssClass="long" 
                    TextMode="MultiLine" Rows="3" Text='<%# Bind("Address") %>'></asp:TextBox>
            </InsertItemTemplate>
            <EditItemTemplate>
                <asp:TextBox id="txtAdress" runat="server" CssClass="long" 
                    TextMode="MultiLine" Rows="3" Text='<%# Bind("Address") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:TextBox id="txtAdress" runat="server" CssClass="long" ReadOnly="true"
                    TextMode="MultiLine" Rows="3" Text='<%# Bind("Address") %>'></asp:TextBox>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="PostCode" HeaderText="邮政编码：" SortExpression="PostCode" />
        <asp:BoundField DataField="DealTimes" HeaderText="交易次数：" InsertVisible="false" ReadOnly="True" SortExpression="DealTimes" />
        <asp:TemplateField>
            <InsertItemTemplate>
                <asp:Button ID="Button1" CommandName="Insert" runat="server" Text="添加" />
            </InsertItemTemplate>
            <EditItemTemplate>
                <asp:Button ID="Button1" CommandName="Update" runat="server" Text="更新" />
            </EditItemTemplate>
            <ItemTemplate></ItemTemplate>
        </asp:TemplateField>
    </Fields>
</asp:DetailsView>
<csla:CslaDataSource ID="AgentDataSource" runat="server" 
    TypeName="Active.Core.Agent, Active.Core" OnDeleteObject="AgentDataSource_DeleteObject"
    OnInsertObject="AgentDataSource_InsertObject" OnSelectObject="AgentDataSource_SelectObject"
    OnUpdateObject="AgentDataSource_UpdateObject" 
    TypeSupportsPaging="False" TypeSupportsSorting="False">
</csla:CslaDataSource>
<uc1:ContactListControl id="ContactListControl1" runat="server">
</uc1:ContactListControl>
</asp:Content>

